﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Main_House : System.Web.UI.UserControl
{
    EncriptManager em = new EncriptManager();
    HouseDao hd = new HouseDao();
    DataTable dt = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        dt = hd.getHouse("4");
        if (dt != null && dt.Rows.Count > 0)
        {
            dlhouse.DataSource = dt;
            dlhouse.DataBind();
            for (int i = 0; i < dlhouse.Items.Count; i++)
            {
                HyperLink hlhouse = dlhouse.Items[i].FindControl("hlhouse") as HyperLink;
                Label labHname = dlhouse.Items[i].FindControl("labHname") as Label;
                string hid = em.Encript(dt.Rows[i][0].ToString());
                hlhouse.NavigateUrl = "HouseInfo.aspx?hid=" + hid;
                if (labHname.Text.Length > 10)
                {
                    labHname.Text = labHname.Text.Substring(0, 10) + "...";
                }
            }
        }
    }
}
